/**
 * @Author wonghiu
 * @Date 2021/7/25 20:52
 * @Version 1.0.1
 */
import java.lang.reflect.Array;
import java.math.BigDecimal;
import java.util.Arrays;
import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        int[] input = new int[]{2,3,1,4,4,4,4,5,5};
        new Main().findRepeatNumber(input,8);
        System.out.println(Arrays.toString(input));

        String a = "hello";
        String b = "he"+new String("llo");
        System.out.println(a==b);

//        Scanner in = new Scanner(System.in);
//        int[] nums = new int[10];
//        int i=0;
//        while (in.hasNextInt()) {// 注意，如果输入是多个测试用例，请通过while循环处理多个测试用例
//            nums[i]=in.nextInt();
//            i++;
//            if (i==10){
//                break;
//            }
//        }
//        System.out.println(sout(nums));
    }
    private static BigDecimal sout(int[] nums) {
        BigDecimal left = new BigDecimal(0);
        BigDecimal right = new BigDecimal(0);
        int count = 0;
        for (int i = nums.length-1; i >=0; i--) {
            while (nums[i]>0){
                if (count%2==0){
                    left = new BigDecimal(10).multiply(left).add(new BigDecimal(i));
                }else {
                    right = new BigDecimal(10).multiply(right).add(new BigDecimal(i));
                }
                count++;
                nums[i]--;
            }
        }
        return left.multiply(right);
    }

    public void findRepeatNumber(int[] nums,int n ) {
        for (int i = 0; i < nums.length; i++) {
            while (nums[i]!=i && nums[i]<n){
                if (nums[nums[i]]>n){
                    nums[nums[i]]++;
                    break;
                }
                if (nums[nums[i]]==nums[i]){
                    nums[nums[i]]=n+1;
                    break;
                }
                int temp = nums[nums[i]];
                nums[nums[i]]=nums[i];
                nums[i]=temp;
            }
        }
        return;
    }
}